import { createRouter, createWebHistory } from "vue-router";
import Start from "../views/Start.vue";
import Index from "../views/Index.vue";
import Myoption from "../views/Myoption.vue";
import Home from '@/views/Home.vue'
import HealthRcode from "@/views/HealthRcode.vue";
import Service from "@/views/Service.vue";
import ChangeUser from "@/views/ChangeUser.vue";
import Order from "@/views/Order.vue";

const router = createRouter({
  history: createWebHistory(import.meta.env.BASE_URL),
  routes: [
    {
      path:'/start',
      name:"start",
      component:Start
    },
    {
      path: '/',
      redirect: '/home'
    },
    {

      path: '/home',
      name: 'home',
      component: Home,
      redirect: '/home/index',
      children: [
        {
          path: "index",
          name: "index",
          component: Index,
        },
        {
          path: "myoption",
          name: "myoption",
          component: Myoption,
        },
        {
          path: "healthRcode",
          name: "healthRcode",
          component: HealthRcode,
        },
        {
          path: "service",
          name: "service",
          component: Service,
        },
        {
          path: "order",
          name: "order",
         component: Order,
        },
      ],
      },
      {
        path: '/user',
        name: 'user',
        component:()=>import('@/views/User.vue')
      },
      {
          path: '/changeuser',
          name: 'changeuser',
          component:ChangeUser,
      },
    {
      path: "/login",
      name: "login",
      component: () => import("@/views/Login.vue"),
    },
    {
      path: "/register",
      name: "register",
      component: () => import("@/views/Register.vue"),
    },
    {
      path: "/idcard",
      name: "idcard",
      component: () => import("@/views/Idcard.vue"),
      },
      {
          path: '/checkappointment',
          name: 'checkappointment',
          component:()=>import("@/views/CheckAppointment.vue")
      },
  ],
});
export default router;
